package com.lvmama.rhino.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lvmama.rhino.entity.LogConditionVO;
import com.lvmama.rhino.mapper.LogMapper;
import com.lvmama.rhino.pojo.Log;
import com.lvmama.rhino.service.LogService;

@Service("logService")
public class LogServiceImpl implements LogService {

	@Autowired
	private LogMapper logMapper;

	@Override
	public void saveLog(Log log) {
		if (log != null) {
			log.preInsert();
			logMapper.save(log);
		}
	}

	@Override
	public PageInfo<Log> findList(LogConditionVO params) {
		PageHelper.startPage(params.getPage(), params.getPageSize());
		List<Log> logs = logMapper.findList(params);
		System.out.println(logs);
		PageInfo<Log> page = new PageInfo<Log>(logs);
		return page;
	}

}
